package com.ssy.lingxi.product.repository.platform;

import com.ssy.lingxi.product.entity.platform.Attribute;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

import java.util.List;

/**
 * 属性持久化层
 * @author jw.chen
 * @version 2.0.0
 * @date 2020/6/22
 */
public interface AttributeRepository extends JpaRepository<Attribute,Long>, JpaSpecificationExecutor<Attribute> {
    Page<Attribute> findByNameContainingAndIsEnableInOrderByIdDesc(String name, List<Boolean> enaList, Pageable page);

    Page<Attribute> findByGroupNameContainingAndNameContainingAndIsEnableInOrderByIdDesc(String groupName, String name, List<Boolean> enaList, Pageable page);

    Page<Attribute> findByNameContainingAndCategoryListId(String name, Long categoryId, Pageable page);

    List<Attribute> findByNameContainingAndCategoryListId(String name, Long categoryId);

    List<Attribute> findByNameContainingAndCategoryListIdIn(String name,List<Long> categoryIdList);

    List<Attribute> findByNameAndIdNot(String name, Long id);

    List<Attribute> findByName(String name);

    List<Attribute> findByIsEnable(Boolean isEnable);

    List<Attribute> findByIsEnableAndTypeNot(Boolean isEnable, Integer type);

    Page<Attribute> findByNameContainingAndIdNotIn(String name, List<Long> idList, Pageable page);

    Page<Attribute> findByNameContaining(String name, Pageable page);

    List<Attribute> findByIdIn(List<Long> attributeIdList);
}
